#include<iostream>
#include<string>
#include<vector>

size_t split(const std::string &str, const std::string &sep, std::vector<std::string> &result)
{
    //111111....222222222....33333
    //查找指定字符位置， 查找到之后进行分割
    size_t pos = 0, idx = 0;
    while(idx < str.size())
    {
        pos = str.find(sep, idx);
        if(pos == std::string::npos)
        {
            //没有找到---》 没有或者走到头了
            result.push_back(str.substr(idx));
            return result.size();
        }

        if(pos == idx) //分隔符之间没有数据
        {
            idx = pos + sep.size();   
            continue;
        }
        
        result.push_back(str.substr(idx, pos - idx));
        idx = pos + sep.size();   
    }

    return result.size();

}


int main()
{
    std::string str = "111111.22222......33..3444.5.6.7...88....99";
    std::vector<std::string> array;
    int n = split(str, ".", array);
    for(auto &s : array)
    {
        std::cout << s << std::endl;
    }

    return 0;
}